import { z } from 'zod';
export const nameSchema = z.string().trim().nonempty();
export const logoSchema = z.union([
    z.string().min(3, 'Must be a path to your logo file including the file extension'),
    z.object({
        light: z.string(),
        dark: z.string(),
        href: z.string().optional(),
    }),
]);
export const modeToggleSchema = z.object({
    default: z.enum(['light', 'dark']).optional(),
    isHidden: z.boolean().optional(),
});
export const isWhiteLabeledSchema = z.boolean();
export const metadataSchema = z.record(z.string(), z.string().nonempty());
export const footerSocialsSchema = z
    .union([
    // TO DO: deprecate array types
    z.array(z.object({
        type: z.string(),
        url: z.string().url('Must be a valid url'),
    })),
    z.record(z.string().trim().nonempty(), z.string().url('Must be a valid url')),
])
    .describe('An object in which each key is the name of a social media platform, and each value is the url to your profile. For example: { "twitter": "https://twitter.com/mintlify" }');
export const feedbackSchema = z.object({
    thumbsRating: z.boolean().optional(),
    suggestEdit: z.boolean().optional(),
    raiseIssue: z.boolean().optional(),
});
export const searchSchema = z.object({
    prompt: z.string().optional(),
});
const redirectSchema = z.object({
    source: z.string(),
    destination: z.string(),
});
export const redirectsSchema = z.array(redirectSchema).refine((value) => {
    const keys = value.map((obj) => obj.source);
    return new Set(keys).size === keys.length;
}, 'Sources in the array must be unique');
export const ctaButtonSchema = z
    .union([
    z
        .object({
        type: z.literal('link').optional(),
        name: z.string(),
        url: z.string().nonempty(),
    })
        .strict(),
    z
        .object({
        type: z.literal('github'),
        url: z.string().url('Must be a valid URL').describe('A link to your GitHub repository'),
    })
        .strict(),
])
    .describe('An object containing the configuration for a Call-to-Action button. The object can have { "type": "link" } (the default) if you define a url and a name. For links to your GitHub repo, use { "type": "github" }');
